module planegame{

    export class GameUtils {

        private static _instance:GameUtils;

        private stageWidth;
        private stageHeight;

        private constructor() {
            this.stageWidth = 0;
            this.stageHeight = 0;
        }

        public static instance():GameUtils {
            if(!this._instance) {
                this._instance = new GameUtils();
            }
            return this._instance;
        }

        /**
         * 根据name关键字创建一个Bitmap对象。name属性请参考resources/resource.json配置文件的内容。
         * Create a Bitmap object according to name keyword.As for the property of name please refer to the configuration file of resources/resource.json.
         */
        public createBitmapByName(name: string) {
            let result = new egret.Bitmap();
            let texture: egret.Texture = RES.getRes(name);
            result.texture = texture;
            return result;
        }

        public setStageWidth(stageWidth: number) {
            this.stageWidth = stageWidth;
        }

        public setStageHeight(stageHeight: number) {
            this.stageHeight = stageHeight;
        }

        public getStageWidth():number {
            return this.stageWidth;
        }

        public getStageHeight():number {
            return this.stageHeight;
        }

    }
}